# -*- encoding: utf-8 -*-
from shapely.wkt import loads as wkt_loads
import dsl
from . import FixtureTest


class ComboOutdoorLandusePois(FixtureTest):
    def test_water_park_way(self):
        # Waterworld in Concord
        self.generate_fixtures(dsl.way(3710152499, wkt_loads('POINT (-122.050548768958 37.97324451957718)'), {u'source': u'openstreetmap.org', u'entrance': u'main'}),dsl.way(31198945, wkt_loads('POLYGON ((-122.052427415712 37.9741442063009, -122.052401723894 37.97490870120568, -122.052341626602 37.9750440944344, -122.050822395793 37.97522671911049, -122.050084160293 37.97474639895169, -122.049140120761 37.9735758576706, -122.050548768958 37.97324451957718, -122.052229966012 37.97285185473669, -122.052427415712 37.9741442063009))'), {u'website': u'http://www.waterworldcalifornia.com/', u'source': u'openstreetmap.org', u'way_area': u'81866', u'name': u'Waterworld', u'leisure': u'water_park'}))  # noqa

        self.assert_has_feature(
            13, 1318, 3160, 'landuse',
            {'kind': 'water_park', 'sort_rank': 121})

        self.assert_has_feature(
            13, 1318, 3160, 'pois',
            {'kind': 'water_park', 'min_zoom': 13})

    def test_water_park_node(self):
        # Antioch WaterPark
        self.generate_fixtures(dsl.way(2753215890, wkt_loads('POINT (-121.772067886777 37.96553969055471)'), {u'source': u'openstreetmap.org', u'name': u'Antioch WaterPark', u'leisure': u'water_park'}))  # noqa

        self.assert_has_feature(
            16, 10600, 25287, 'pois',
            {'kind': 'water_park', 'min_zoom': 15})

    def test_beach_resort_way(self):
        # Sandos Finisterra Los Cabos, extra large resort
        self.generate_fixtures(dsl.way(381817396, wkt_loads('POLYGON ((-109.911528186215 22.8774976682163, -109.911490726468 22.87811219854719, -109.909321744214 22.87794062692459, -109.909130762385 22.87774182538109, -109.909169030616 22.87528426003229, -109.910665534048 22.87476001560358, -109.910748897706 22.87575387670478, -109.911159787117 22.87626752325368, -109.911528186215 22.8774976682163))'), {u'name': u'Sandos Finisterra Los Cabos', u'way_area': u'80573.9', u'leisure': u'beach_resort', u'source': u'openstreetmap.org', u'landuse': u'commercial', u'tourism': u'hotel'}))  # noqa

        self.assert_has_feature(
            14, 3189, 7122, 'pois',
            {'kind': 'beach_resort', 'min_zoom': 14})

    def test_beach_resort_node(self):
        # Hilton Hawaiian Village
        # really this should be merged with its large AOI!
        self.generate_fixtures(dsl.way(2407351205, wkt_loads('POINT (-157.837960852959 21.2830034117716)'), {u'addr:housenumber': u'2005', u'name': u'Hilton Hawaiian Village', u'wheelchair:description': u'Clearly labeled accessible pathways and features. ADA compliant rooms and swimming pool!', u'wheelchair': u'yes', u'leisure': u'beach_resort', u'addr:city': u'Honolulu', u'source': u'openstreetmap.org', u'addr:street': u'Kalia Road'}))  # noqa

        self.assert_has_feature(
            16, 4034, 28801, 'pois',
            {'kind': 'beach_resort', 'min_zoom': 16})

    def test_another_beach_resort_node(self):
        # Silver Gull Beach Club
        self.generate_fixtures(dsl.way(3575812477, wkt_loads('POINT (-73.90201124147698 40.55765950893559)'), {u'source': u'openstreetmap.org', u'name': u'Silver Gull Beach Club', u'leisure': u'beach_resort'}))  # noqa

        self.assert_has_feature(
            16, 19314, 24677, 'pois',
            {'kind': 'beach_resort', 'min_zoom': 16})

    def test_beach_resort_hotel(self):
        # Terrasol Beach Resort
        # Needs to appear **before** tourism=hotel
        self.generate_fixtures(dsl.way(381817391, wkt_loads('POLYGON ((-109.908072007991 22.87663500364009, -109.906840597399 22.8770294645879, -109.906859192526 22.87714260497978, -109.90672893681 22.87716337910149, -109.906736392827 22.87734968393129, -109.90642449776 22.87725549698129, -109.905270432114 22.8751045737028, -109.905714199865 22.87495402104009, -109.906376437892 22.87489666365959, -109.906832602393 22.87480487524709, -109.908072007991 22.87663500364009))'), {u'name': u'Terrasol Beach Resort', u'way_area': u'50750.2', u'leisure': u'beach_resort', u'source': u'openstreetmap.org', u'landuse': u'commercial', u'tourism': u'hotel'}))  # noqa

        self.assert_has_feature(
            16, 12760, 28488, 'pois',
            {'id': 381817391, 'kind': 'beach_resort'})

    def test_beach(self):
        # Needs to appear **after** natural=beach.
        # Unnamed beach in Maskenthine Lake area
        self.generate_fixtures(dsl.way(257716817, wkt_loads('POLYGON ((-97.23657827452129 41.97736257162749, -97.23656488962359 41.97741239066617, -97.2365274298762 41.97746227644729, -97.2364897904658 41.9774662833356, -97.23645502566428 41.97747830399917, -97.23643894582069 41.97750815530388, -97.23641738625389 41.97756799143391, -97.23648449040559 41.97765166842779, -97.23648179545981 41.9776815864325, -97.23643616104339 41.97769961736599, -97.2362617980467 41.97772345825911, -97.23621364834749 41.97770709686279, -97.23638091465338 41.97733559186379, -97.23643077115169 41.97710826686608, -97.236428615195 41.97698959541528, -97.2364006775896 41.97689870508889, -97.23645763077859 41.97685609811668, -97.23650587030939 41.9768760659646, -97.2365327299364 41.97698371860168, -97.2365515047258 41.97710138833558, -97.2365462046657 41.97720109356419, -97.2365462046657 41.97729478828849, -97.2365595895634 41.97732670990938, -97.23657827452129 41.97736257162749))'), {u'natural': u'beach', u'way_area': u'2181.95', u'surface': u'sand', u'access': u'yes', u'source': u'openstreetmap.org', u'leisure': u'beach_resort'}))  # noqa

        self.assert_has_feature(
            16, 15066, 24333, 'landuse',
            {'kind': 'beach', 'id': 257716817})

    def test_summer_camp(self):
        # Camp Ahmek
        self.generate_fixtures(dsl.way(3655879348, wkt_loads('POINT (-78.7068316389515 45.5614200134323)'), {u'source': u'openstreetmap.org', u'name': u'Camp Ahmek', u'leisure': u'summer_camp'}))  # noqa

        self.assert_has_feature(
            15, 9219, 11714, 'pois',
            {'kind': 'summer_camp', 'min_zoom': 15})

        # Camp Goodtimes
        self.generate_fixtures(dsl.way(4050178586, wkt_loads('POINT (-122.58818319015 49.3035588116317)'), {u'website': u'http://www.campgoodtimes.org/', u'source': u'openstreetmap.org', u'name': u'Camp Goodtimes', u'leisure': u'summer_camp'}))  # noqa

        self.assert_has_feature(
            15, 5225, 11211, 'pois',
            {'kind': 'summer_camp', 'min_zoom': 15})

    def test_battlefield_nodes(self):
        # Battle of Blackburn's Ford (1861)
        self.generate_fixtures(dsl.way(3838356961, wkt_loads('POINT (-77.4495472316781 38.80331937506308)'), {u'source': u'openstreetmap.org', u'historic': u'battlefield', u'name': u"Battle of Blackburn's Ford (1861)"}))  # noqa

        self.assert_has_feature(
            16, 18668, 25092, 'pois',
            {'kind': 'battlefield', 'min_zoom': 17})

        # 2nd Battle of Kernstown
        self.generate_fixtures(dsl.way(3992988013, wkt_loads('POINT (-78.19618961575398 39.1403245573439)'), {u'source': u'openstreetmap.org', u'historic': u'battlefield', u'name': u'2nd Battle of Kernstown (1864)'}))  # noqa

        self.assert_has_feature(
            16, 18532, 25013, 'pois',
            {'kind': 'battlefield', 'min_zoom': 17})

    def test_battlefield_ways(self):
        # Antietam National Battlefield
        self.generate_fixtures(dsl.way(231393152, wkt_loads('POLYGON ((-77.7571536513265 39.47738031729748, -77.75650991859391 39.48092461682239, -77.7516582974074 39.48305109598149, -77.75131711726249 39.4856610921356, -77.75102848856169 39.4873195968996, -77.7505575018583 39.49033096937768, -77.75144593567428 39.4904618564733, -77.7518202636532 39.48819479891898, -77.7536517488544 39.48835785815387, -77.75316252635071 39.49132301531999, -77.75049309265241 39.4910769809272, -77.75000000739298 39.49515248489939, -77.74092468740359 39.4906909082977, -77.7408964803037 39.49020860913168, -77.74088983277059 39.48988159771769, -77.740900612554 39.48953378677329, -77.74089522266229 39.48882380890269, -77.7409421147201 39.48857131819859, -77.7410400310861 39.4880133673396, -77.74127404221758 39.48686625400699, -77.7419357412559 39.48421941849621, -77.7434618890921 39.48442061952611, -77.7430941188148 39.4831989833595, -77.74299701093248 39.48240657235379, -77.74176730714008 39.48245878065399, -77.7415921356597 39.4812814150282, -77.74838043476718 39.4807557853195, -77.74666698819429 39.47589159800938, -77.7414874819291 39.48096926869969, -77.73462309551699 39.48082525935928, -77.73654566988809 39.4784154680689, -77.7350930042422 39.47785070991189, -77.73331523829491 39.47831520562958, -77.73264886801709 39.4767177822101, -77.7289560735472 39.47765191672308, -77.72745624634879 39.47658527443539, -77.72659575013809 39.47639320358648, -77.7253962297392 39.4763206741677, -77.72543782173689 39.47599865927669, -77.72542174189329 39.4757667854432, -77.725215129378 39.4753185678039, -77.72494150254241 39.47481757854999, -77.72470695242178 39.4744418169064, -77.72445201054408 39.47413740618869, -77.7241557461634 39.47387661043469, -77.72371045127709 39.47354938353649, -77.72337385254011 39.47328650529269, -77.7231860148142 39.47302036692938, -77.7229566749222 39.4726570774055, -77.72278500687139 39.47241069959791, -77.72271934002408 39.47223567582368, -77.72271134501808 39.4720639107805, -77.7227621896632 39.47187030187457, -77.72294059507858 39.4715794020937, -77.72328527865308 39.47114558123369, -77.72367146439369 39.4705357587826, -77.72395452353979 39.4702065744853, -77.7243849962239 39.46992919025771, -77.72503807143549 39.4695377992316, -77.72572474363868 39.4691391939182, -77.7263148469488 39.46880896280408, -77.7266702204752 39.4685407962334, -77.72710213046381 39.4681464154349, -77.72727514598751 39.46785959163208, -77.72730730567469 39.46760910527428, -77.72719061451929 39.46735230727771, -77.72695318978968 39.46701270555519, -77.7266889952646 39.46665548741528, -77.72634700663599 39.46627246930618, -77.7259151864789 39.4657671845417, -77.72563491211029 39.4654338166445, -77.7253894923746 39.46520398812729, -77.725311698271 39.4650548835235, -77.7252956184274 39.46495661301228, -77.72440709477991 39.46556017346001, -77.723465121373 39.46485778755228, -77.72605604231541 39.46295725996779, -77.72643962294178 39.46214547669301, -77.72682580868241 39.46130476300839, -77.72740782715502 39.46037075578698, -77.72766402667401 39.459796210627, -77.72787189683069 39.45941100470967, -77.72817301211398 39.45905416369259, -77.7286824467116 39.45860715618349, -77.72935034412539 39.4578999837476, -77.73021533191239 39.45699298088689, -77.72732742793708 39.45452007746609, -77.72928719256089 39.44937665918739, -77.72869178919061 39.4491933921929, -77.7283900450866 39.44909190840738, -77.72816609508628 39.448949983467, -77.7279903846167 39.44877601056468, -77.7278697408741 39.44860828029749, -77.7278347964095 39.44846226168389, -77.72625034791139 39.44710548786819, -77.7258554485125 39.44631509371761, -77.72966682059999 39.44551699046867, -77.72956746692951 39.44505609121459, -77.7293838512855 39.44460351348219, -77.72909279713339 39.4440742768392, -77.72878296819189 39.44352228199608, -77.7283981299242 39.44301266970221, -77.72812450308869 39.44262015608489, -77.72795687745661 39.44232920341818, -77.7279541825108 39.44188486348789, -77.72800251187309 39.44167570015068, -77.7280989909346 39.44153889380729, -77.7282398467711 39.4414478050533, -77.7284236420783 39.44137940169139, -77.72865154466591 39.4413556061857, -77.72901105044259 39.4413773898268, -77.72931000976908 39.44137530858748, -77.729744524872 39.44129448707969, -77.73072359870018 39.44104175449769, -77.73130426969989 39.44091438192388, -77.7318755982206 39.4408180892134, -77.73228190622349 39.4407030650375, -77.7327915204842 39.44051457205398, -77.7335077472603 39.440245255835, -77.73676449949129 39.44427427590178, -77.7418714218815 39.44609865984219, -77.7459892093124 39.4469636976172, -77.74597312946878 39.44737789914999, -77.74652783915678 39.4487713629572, -77.74686569553509 39.45130155778968, -77.74049601135 39.4506686015089, -77.73938021393562 39.4531936639095, -77.7396623747664 39.45413810236229, -77.73963767109609 39.4546318188335, -77.7392728652592 39.45496225594318, -77.7388202041875 39.45511228386128, -77.73845539835058 39.4551115208907, -77.74188498644229 39.45809626712708, -77.74244221141309 39.45919315504679, -77.74264514083571 39.45952537377579, -77.7428283073222 39.4598095963902, -77.7414368169471 39.46034557965589, -77.74132470719958 39.46061350038547, -77.74078374173548 39.46165666832228, -77.74360570936901 39.4624312837427, -77.74537817525611 39.46297002094499, -77.7453281390948 39.46345798785998, -77.74523758891418 39.46564998236328, -77.74500214047821 39.46890036250069, -77.74501929830021 39.4701866722038, -77.74552028873411 39.47113171223582, -77.74616078753169 39.4717635809758, -77.74695049649789 39.47232589217428, -77.74672304306799 39.4724179806883, -77.7464248023937 39.47247761625728, -77.7464248023937 39.4729744617726, -77.745864702814 39.47304741073871, -77.74637970696638 39.4742399629324, -77.74917140137489 39.47403457192537, -77.7492979739984 39.47298111871558, -77.74788393590968 39.47221258430239, -77.75063053489089 39.4717156640018, -77.75286212971969 39.47184818105199, -77.7532483154603 39.47032425440981, -77.75532495090259 39.47041315567039, -77.75406371624369 39.47714837873037, -77.7571536513265 39.47738031729748))'), {u'gnis:state_id': u'24', u'name': u'Antietam National Battlefield', u'way_area': u'1.29683e+07', u'gnis:county_id': u'043', u'leisure': u'park', u'ele': u'146', u'source': u'openstreetmap.org', u'historic': u'battlefield', u'date': u'1862', u'gnis:created': u'09/13/1996', u'boundary': u'national_park', u'gnis:feature_id': u'589057'}))  # noqa

        self.assert_has_feature(
            10, 290, 389, 'pois',
            {'kind': 'battlefield', 'min_zoom': 10})

        self.assert_has_feature(
            10, 290, 389, 'landuse',
            {'kind': 'battlefield', 'sort_rank': 25})

        # White Oak Road Battlefield
        self.generate_fixtures(dsl.way(316054549, wkt_loads('POLYGON ((-77.565081806157 37.1419568067139, -77.5521795732257 37.14196217734999, -77.55216843411618 37.14258330674419, -77.552167895127 37.14262412323089, -77.55216681714869 37.14271177119101, -77.5521619662462 37.1431056128957, -77.552159900121 37.1432814088492, -77.5469617088979 37.14352816696068, -77.5469115829051 37.1419643972128, -77.5441524075099 37.14195780923269, -77.54403912995258 37.1435066848588, -77.54282047543809 37.1456199216102, -77.5445457797728 37.14662331604248, -77.54502287502019 37.14680991600809, -77.5459458939746 37.1512800863047, -77.54594831942589 37.151287461069, -77.5476693118472 37.1515702791572, -77.54815979199229 37.1516836924934, -77.5481787464448 37.15168806004911, -77.54739793079992 37.15164008852248, -77.5468219310397 37.15160629363778, -77.54649539343391 37.15158459903228, -77.54637474969131 37.1515765799026, -77.54611881966679 37.15155846525818, -77.5460382407858 37.151552808906, -77.5455472216515 37.15151786839139, -77.5448795039009 37.15146288000778, -77.54431347544029 37.1514129035516, -77.54424960522358 37.15140681759117, -77.54424421533189 37.15140617319538, -77.54418591466998 37.15140008723438, -77.54412222411628 37.1513927840807, -77.54405871322579 37.15138497972928, -77.54399520233521 37.15137660258058, -77.5439318711076 37.15136758103478, -77.5438689890377 37.15135820149, -77.5437428655719 37.15133750920769, -77.5436470153311 37.15131982410379, -77.54355062610109 37.1513014229995, -77.5434544165341 37.1512823774937, -77.54336027309239 37.15126318878378, -77.54326253638941 37.1512425680752, -77.54316686581168 37.15122187576129, -77.5429664516718 37.15117655312999, -77.5428618877727 37.1511520660099, -77.54275759336819 37.15112700608339, -77.54265347862679 37.15110137335, -77.54254873506468 37.15107488140968, -77.5415227691787 37.15083079712308, -77.54149186713289 37.15082349391429, -77.54127366635041 37.15077315903488, -77.54073647381048 37.15064929069658, -77.5402742007653 37.15054561345749, -77.5397375472145 37.1504473061099, -77.5395155735079 37.15040656544549, -77.53940283493969 37.15039081333739, -77.53929171333908 37.15037577723107, -77.53918050190688 37.15036145712708, -77.5390691108116 37.15034770982479, -77.53895762988491 37.15033460692489, -77.53879081273661 37.1503162771813, -77.5387350273575 37.1503104059344, -77.53865992819969 37.1503019570661, -77.53713539733099 37.15013197709088, -77.5365319091232 37.1500633119463, -77.53653244811228 37.15005915909928, -77.53653828716169 37.15000968292141, -77.53682817350391 37.1475495089644, -77.53730652639268 37.14754771888462, -77.53817870070201 37.14532992073969, -77.5389701164673 37.14346586884828, -77.53406414720619 37.14105367512509, -77.53520464829089 37.14049619436879, -77.53523492151598 37.14048137112499, -77.53533023276759 37.14043489629827, -77.53568057572841 37.14031810042128, -77.52966743287961 37.1365233894929, -77.5296649175968 37.13652181399298, -77.52973112343319 37.13645872235999, -77.5357895413724 37.1402817941248, -77.5363779378835 37.14008565389029, -77.53650271387639 37.1400716898893, -77.53665273252889 37.14008300431089, -77.5368562009407 37.14003738856299, -77.53709802741518 37.13992617768409, -77.53721220328779 37.13985471046509, -77.54137993704849 37.1398953135928, -77.54359850630568 37.1399167967204, -77.54521673145848 37.13889476597458, -77.5434090516123 37.13747870924649, -77.54355538717211 37.13729251593809, -77.5424480339213 37.13664298415549, -77.54265671256178 37.13562771255759, -77.54186242218761 37.13612629088869, -77.5369161185702 37.1320827846269, -77.53783635274721 37.1311495985473, -77.5371312650807 37.13005948226109, -77.54677944072679 37.1239371788359, -77.5469292797162 37.1241229752552, -77.54719724716539 37.1236638552868, -77.5475324085979 37.12346466368231, -77.54804687376109 37.12335478934039, -77.54906673110318 37.1229784649292, -77.54958514885369 37.1239351733208, -77.54972330974439 37.12419037469169, -77.54982428038228 37.12437667186528, -77.5500751798411 37.12456425782948, -77.55042489398129 37.12457557457, -77.55232240535588 37.1292274711103, -77.5547732789455 37.13101545657838, -77.55461194152051 37.1320315778611, -77.5547069832776 37.13225968046039, -77.5555001058419 37.1328228796635, -77.55514401366329 37.1340783175303, -77.5553482905589 37.13476095760389, -77.55588224916379 37.1346837562763, -77.5559780994046 37.13616245595158, -77.55605894778019 37.13636820260389, -77.55614527587899 37.1365884862519, -77.55628379609578 37.1367647986445, -77.55645160139089 37.13697849272398, -77.55666010036829 37.1372439623769, -77.55667671920109 37.13737909588351, -77.55880994850628 37.13820199428929, -77.55949141048079 37.13814878652629, -77.5600336335863 37.13852990510139, -77.562258401219 37.13919789634888, -77.5624350100038 37.13914161000699, -77.56351370699699 37.13934827949988, -77.5640125414743 37.13881219800559, -77.5650325784794 37.1389424591402, -77.565081806157 37.1419568067139))'), {u'website': u'http://www.civilwar.org/', u'name': u'White Oak Road Battlefield', u'way_area': u'5.44096e+06', u'source': u'openstreetmap.org', u'historic': u'battlefield', u'owner': u'Civil War Trust', u'boundary': u'protected_area'}))  # noqa

        self.assert_has_feature(
            11, 582, 796, 'pois',
            {'kind': 'battlefield', 'min_zoom': 10})

        self.assert_has_feature(
            11, 582, 796, 'landuse',
            {'kind': 'battlefield', 'sort_rank': 25})

    def test_boat_storage_node(self):
        # unnamed Boat Storage
        self.generate_fixtures(dsl.way(2117389172, wkt_loads('POINT (-121.970562865891 37.24155295545678)'), {u'source': u'openstreetmap.org', u'amenity': u'boat_storage'}))  # noqa

        self.assert_has_feature(
            16, 10563, 25453, 'pois',
            {'kind': 'boat_storage', 'min_zoom': 17})

    def test_boat_storage_way(self):
        # in Tiburon, CA
        self.generate_fixtures(dsl.way(261064362, wkt_loads('POLYGON ((-122.448582479715 37.88885607598908, -122.448190904082 37.88904869843268, -122.447988423817 37.88876086345788, -122.448498038078 37.88871747542818, -122.448582479715 37.88885607598908))'), {u'source': u'openstreetmap.org', u'amenity': u'boat_storage', u'way_area': u'1774.38'}))  # noqa

        self.assert_has_feature(
            16, 10476, 25304, 'pois',
            {'kind': 'boat_storage', 'min_zoom': 17})

    def test_monument_nodes(self):
        # Red Cross monument in DC
        self.generate_fixtures(dsl.way(3314950786, wkt_loads('POINT (-77.04514662151358 38.896204468872)'), {u'source': u'openstreetmap.org', u'historic': u'monument', u'name': u'Red Cross'}))  # noqa

        self.assert_has_feature(
            16, 18742, 25070, 'pois',
            {'kind': 'monument', 'min_zoom': 17})

        # Major General James B. McPherson in DC
        self.generate_fixtures(dsl.way(2316449632, wkt_loads('POINT (-77.0341319286574 38.90196197487669)'), {u'wikipedia': u'en:Major General James B. McPherson (statue)', u'historic': u'monument', u'wikidata': u'Q15243968', u'name': u'Major General James B. McPherson', u'source': u'openstreetmap.org'}))  # noqa

        self.assert_has_feature(
            16, 18744, 25069, 'pois',
            {'kind': 'monument', 'min_zoom': 17})

    def test_monument_ways(self):
        # polygon but no landuse / Netherlands Carillon near DC
        self.generate_fixtures(dsl.way(504619701, wkt_loads('POINT (-77.06945251781912 38.8881826544277)'), {u'source': u'openstreetmap.org', u'wpt_description': u'20-SEP-09 3:45:57PM', u'name': u'083', u'ele': u'33.771729'}),dsl.way(504619705, wkt_loads('POINT (-77.06953830692871 38.8881826544277)'), {u'source': u'openstreetmap.org', u'wpt_description': u'20-SEP-09 3:42:59PM', u'name': u'080', u'ele': u'28.724976'}),dsl.way(41273627, wkt_loads('POLYGON ((-77.06953830692871 38.8881826544277, -77.06953830692871 38.88824950021529, -77.06945251781912 38.88824950021529, -77.06945251781912 38.8881826544277, -77.06953830692871 38.8881826544277))'), {u'way_area': u'91.298', u'source': u'openstreetmap.org', u'historic': u'monument', u'name': u'Netherlands Carillon'}))  # noqa

        self.assert_has_feature(
            16, 18737, 25072, 'pois',
            {'kind': 'monument', 'min_zoom': (lambda z: z >= 16 and z < 17)})

        # building, Jefferson Monument
        self.generate_fixtures(dsl.way(248460669, wkt_loads('POLYGON ((-77.0370703179518 38.8813805569467, -77.03706573654379 38.88143027651917, -77.0370529804668 38.88148006598588, -77.0370291751117 38.88153419101258, -77.03699899171821 38.88158118325048, -77.03695793870969 38.88162810552841, -77.0369230840767 38.881659014076, -77.0368929905147 38.88168188079841, -77.036878078481 38.88168992261029, -77.03687744966028 38.88175348785668, -77.0368896667481 38.88175411721529, -77.03688948708511 38.88179509544039, -77.03688912775888 38.88184390565048, -77.03664577414848 38.88184285672079, -77.0364399701169 38.88184208750568, -77.03619679616949 38.88184110850469, -77.03619706566408 38.8817902703606, -77.03619742499021 38.8817488026315, -77.0362118878663 38.8817488026315, -77.03621242685539 38.88169670570311, -77.03621242685539 38.88168341923199, -77.03616993654252 38.8816523009085, -77.03615089225849 38.88163537812908, -77.03611271385888 38.88159446974068, -77.03607363714399 38.88153698817049, -77.03605055044119 38.88148677916968, -77.03604004015239 38.88145188459259, -77.03603123666258 38.88138230517421, -77.03603707571199 38.88131552285419, -77.0360539640393 38.8812576214831, -77.03607327781791 38.88121699259429, -77.03611064773368 38.88116181838618, -77.03615709063391 38.88111258813138, -77.03619464021278 38.88108209892239, -77.0362464730047 38.88104881252328, -77.0362954311877 38.88102440714939, -77.03633657402769 38.88101077090526, -77.0363929882275 38.88099972204919, -77.0363947848581 38.88097937256921, -77.0367349768562 38.8809820998194, -77.0367350666877 38.88100265908709, -77.03678734863729 38.88101909251098, -77.03685112902239 38.88104671464049, -77.0368886786013 38.88106951163047, -77.0369247908757 38.88109601487028, -77.03695793870969 38.88112545513309, -77.0369994408758 38.8811727972878, -77.0370261208398 38.88121349613108, -77.03704839905879 38.88126048858109, -77.037063041598 38.88130901944169, -77.0370682518266 38.88133978826989, -77.0370703179518 38.8813805569467))'), {u'building': u'yes', u'name:en': u'Jefferson Monument', u'name': u'Jefferson Monument', u'way_area': u'11480.4', u'wikipedia': u'en:Jefferson Memorial', u'name:de': u'Jefferson-Denkmal', u'source': u'openstreetmap.org', u'historic': u'monument', u'wikidata': u'Q326183', u'name:it': u'Monumento a Jefferson', u'ref:nrhp': u'66000029', u'tourism': u'attraction', u'start_date': u'1943', u'name:es': u'Monumento a Jefferson', u'alt_name': u'Jefferson Memorial'}))  # noqa

        self.assert_has_feature(
            15, 9371, 12537, 'pois',
            {'kind': 'monument', 'min_zoom': 15})

    def test_monument_building_attraction(self):
        # building, and tourism=attraction, National World War II Memorial
        self.generate_fixtures(dsl.way(66418767, wkt_loads('POLYGON ((-77.04105542421519 38.88959416399089, -77.04096020279511 38.8895952827271, -77.0409292109178 38.88959570225321, -77.0409228328792 38.88962045428789, -77.0409149277047 38.8896513593585, -77.04088133071311 38.88971051246538, -77.04084782355299 38.88976141486299, -77.04080362644099 38.88981371564017, -77.040759429329 38.88985077365418, -77.04071873564669 38.88987147019699, -77.04067462836619 38.8898906983986, -77.04061453107369 38.889905871194, -77.04055623041178 38.88991265350239, -77.04052577752358 38.88991328278869, -77.04047843630819 38.88991412183711, -77.04042363907578 38.8899099965157, -77.0403692011696 38.88989440419681, -77.0403105411816 38.88986727495231, -77.0402558337808 38.88983021694688, -77.04022044015861 38.88979441749699, -77.04018684316688 38.88974631195759, -77.04015863606701 38.8897008633804, -77.04013914262541 38.8896513593585, -77.0401145287866 38.8896513593585, -77.0397804453324 38.8896513593585, -77.039782241963 38.88976686868919, -77.03964983029009 38.88976519058888, -77.03962315032619 38.8897654003514, -77.0396051840205 38.88976547027229, -77.03960293823231 38.88965660343028, -77.03956988022979 38.88965688311408, -77.0395743718062 38.88917002184471, -77.039611382396 38.88916918278748, -77.039611382396 38.8890531131126, -77.03962854021789 38.88905290334799, -77.03976804858149 38.88905108538769, -77.0397683180761 38.88916638593012, -77.04010312018248 38.88916456797268, -77.04012503907539 38.88916449805129, -77.04014444268549 38.8891191190233, -77.0401692361874 38.88907779541479, -77.0401939398577 38.8890420655071, -77.04022223678921 38.8890048672281, -77.04026284063998 38.88897046579469, -77.04031584124169 38.88893886121119, -77.0403618349843 38.8889169058064, -77.0404077388953 38.88890306131199, -77.04045373263789 38.8888948804731, -77.04050610441891 38.88889411133439, -77.04054033023129 38.888893482039, -77.04059153420241 38.8888990058535, -77.04065513492461 38.88891550737279, -77.0407152322171 38.88894165807761, -77.04076472938918 38.88897186422729, -77.04080003317991 38.88900081177539, -77.04083012674189 38.88903108782159, -77.0408566270428 38.88906821616541, -77.04089723089361 38.88914107436559, -77.04091825147128 38.8891910681929, -77.04095696886 38.8891910681929, -77.0410466207254 38.8891912080358, -77.04105542421519 38.88959416399089))'), {u'addr:housenumber': u'1964', u'name': u'National World War II Memorial', u'name:lt': u'Nacionalinis Antrojo pasaulinio karo memorialas', u'source': u'openstreetmap.org', u'addr:postcode': u'20227', u'wheelchair': u'yes', u'way_area': u'16778.2', u'wikipedia': u'en:National World War II Memorial', u'addr:state': u'D.C.', u'name:de': u'Nationales Denkmal des 2. Weltkriegs', u'phone': u'202-208-3818', u'start_date': u'2002', u'historic': u'monument', u'wikidata': u'Q1470020', u'name:it': u'Memoriale Nazionale della Seconda Guerra Mondiale', u'name:pl': u'Pomnik II Wojny \u015awiatowej', u'addr:street': u'Independence Avenue Southwest', u'tourism': u'attraction', u'email': u'WWII.CustomerService@Oaktreesys.com', u'addr:city': u'Washington'}))  # noqa

        self.assert_has_feature(
            15, 9371, 12536, 'pois',
            {'kind': 'monument', 'min_zoom': 15})

    def test_dam_node(self):
        # Letts Valley 1-039 Dam
        self.generate_fixtures(dsl.way(358811238, wkt_loads('POINT (-122.716532232156 39.3079024910915)'), {u'gnis:state_id': u'06', u'name': u'Letts Valley 1-039 Dam', u'gnis:county_id': u'011', u'ele': u'1418', u'source': u'openstreetmap.org', u'gnis:created': u'07/01/1994', u'waterway': u'dam', u'gnis:feature_id': u'1663242'}))  # noqa

        self.assert_has_feature(
            14, 2607, 6243, 'pois',
            {'kind': 'dam', 'min_zoom': 14})

    def test_dam_way(self):
        # O'Shaughnessy Dam, Yosemite
        # 13, 1370, 3161
        self.generate_fixtures(dsl.way(189656737, wkt_loads('POLYGON ((-119.789060343112 37.94813892096909, -119.789017403642 37.94832076250939, -119.788941496 37.94841178936769, -119.788826601476 37.9483809748407, -119.788329743292 37.94814848413098, -119.788040665433 37.94793079792151, -119.787833873255 37.94772409105717, -119.787719607551 37.94777559073129, -119.78769427506 37.94774321748778, -119.787665079813 37.94770878990909, -119.78775068926 37.94765785689778, -119.787658072954 37.94752538839991, -119.78767136802 37.94751738361128, -119.787606779151 37.94740085362629, -119.787624116636 37.947394903154, -119.787499520306 37.94707959827269, -119.787451011281 37.94675125755689, -119.787461431738 37.94649219675929, -119.787555036191 37.94650686060238, -119.787880136492 37.9469248143209, -119.788051804543 37.94708979912581, -119.78829318186 37.9472209224657, -119.7885400389 37.9472843942955, -119.788638584087 37.94737776012397, -119.788673887877 37.94741147946841, -119.788717007011 37.94744930745397, -119.78878159588 37.94748366431551, -119.788792106169 37.94753821022748, -119.78880279612 37.94774116316769, -119.788899365014 37.94781306433669, -119.788985243955 37.9478638555634, -119.789028093594 37.94794850752979, -119.789060343112 37.94813892096909))'), {u'name': u"O'Shaughnessy Dam", u'way_area': u'20361.8', u'wikipedia': u"en:O'Shaughnessy Dam (California)", u'source': u'openstreetmap.org', u'wikidata': u'Q7071958', u'waterway': u'dam'}))  # noqa

        self.assert_has_feature(
            13, 1370, 3161, 'landuse',
            {'kind': 'dam', 'sort_rank': 223})

        self.assert_has_feature(
            12, 685, 1580, 'pois',
            {'kind': 'dam', 'min_zoom': 12})

    def test_linear_dam_way(self):
        # Named dam line in front of Cherry Lake
        # Should be labeled in the stylesheet, no POI generate
        self.generate_fixtures(dsl.way(62201624, wkt_loads('LINESTRING (-119.914729171638 37.97434928092859, -119.906693292263 37.9770387079972)'), {u'gnis:state_id': u'06', u'name': u'Cherry Valley Dam', u'gnis:county_id': u'109', u'ele': u'1420', u'source': u'openstreetmap.org', u'gnis:created': u'01/19/1981', u'waterway': u'dam', u'gnis:feature_id': u'258257'}))  # noqa

        self.assert_has_feature(
            12, 683, 1580, 'landuse',
            {'kind': 'dam', "sort_rank": 265})

    def test_dog_park_node(self):
        # Indian Lake Dog Exercise Area, near Madison, WI
        self.generate_fixtures(dsl.way(262220409, wkt_loads('POINT (-89.63521750678829 43.18944849586439)'), {u'source': u'openstreetmap.org', u'name': u'Indian Lake Dog Exercise Area', u'leisure': u'dog_park'}))  # noqa

        self.assert_has_feature(
            16, 16450, 24033, 'pois',
            {'kind': 'dog_park', 'min_zoom': 17})

    def test_dog_park_ways(self):
        # Dog Run at Upper Noe Valley Rec Center, SF
        self.generate_fixtures(dsl.way(4177860895, wkt_loads('POINT (-122.427832025472 37.74251689791318)'), {u'source': u'openstreetmap.org', u'barrier': u'gate'}),dsl.way(417184097, wkt_loads('POLYGON ((-122.427847117169 37.74273277610897, -122.427162331428 37.74276488429628, -122.427153438107 37.74274030590639, -122.426962096951 37.74274961159829, -122.426933171199 37.74249849957781, -122.427082111873 37.7424879152052, -122.427055431909 37.74231181659579, -122.427054623425 37.74230116116019, -122.427069176133 37.74230052183398, -122.427060103149 37.7421694598501, -122.427100796831 37.74216839430459, -122.42711427156 37.74235209412828, -122.427155234737 37.74236857452328, -122.427162511091 37.74243861616107, -122.427193502968 37.7427378196526, -122.427792589431 37.74269981547749, -122.427810286242 37.74267140112828, -122.427803818372 37.7425296133624, -122.427808759106 37.74251512201229, -122.427832025472 37.74251689791318, -122.427847117169 37.74273277610897))'), {u'name': u'Dog Run', u'barrier': u'fence', u'way_area': u'1662.33', u'leisure': u'dog_park', u'source': u'openstreetmap.org', u'addr:city': u'San Francisco'}))  # noqa

        self.assert_has_feature(
            16, 10480, 25338, 'pois',
            {'kind': 'dog_park', 'min_zoom': 16})

        # Dog park at Walter Hass Playground, SF
        self.generate_fixtures(dsl.way(375333476, wkt_loads('POLYGON ((-122.435567238721 37.74031275899967, -122.435563196302 37.74034671522779, -122.435532294256 37.74039232168538, -122.43549609215 37.74042308116498, -122.435470579996 37.74046655643549, -122.435455937457 37.74051429395798, -122.435449200092 37.74056728825491, -122.43543437789 37.74060337550239, -122.435402218203 37.74062987262371, -122.435360716037 37.74064471953209, -122.435347600634 37.74064599821298, -122.435327119045 37.74064791623439, -122.435293611885 37.7406436539646, -122.435262799671 37.74063306932671, -122.43523863499 37.74061495467461, -122.435223902619 37.7405842663125, -122.435222465315 37.74055350689979, -122.435231897625 37.7405238130436, -122.435252019888 37.74049305360581, -122.435272231981 37.74045909744478, -122.435281484629 37.74042627787698, -122.435289569466 37.74037008676489, -122.435285616879 37.7403234147215, -122.435299001777 37.74027780822149, -122.435325771572 37.74025017436279, -122.435378143353 37.74022161699669, -122.435420992992 37.74021096126019, -122.435477317361 37.7402141579813, -122.43552429925 37.74024065524199, -122.435551069046 37.74027667161049, -122.435567238721 37.74031275899967))'), {u'source': u'openstreetmap.org', u'way_area': u'1480.15', u'name': u'Dog Park', u'leisure': u'dog_park'}))  # noqa

        self.assert_has_feature(
            16, 10479, 25338, 'pois',
            {'kind': 'dog_park', 'min_zoom': 16})

        self.assert_has_feature(
            16, 10479, 25338, 'landuse',
            {'kind': 'dog_park', 'sort_rank': 111})

    def test_recreation_track_way(self):
        # Red Gra / Running Track
        self.generate_fixtures(dsl.way(95922608, wkt_loads('POLYGON ((0.002371732013132 51.1255746157489, 0.002473421303295 51.12573259131459, 0.002628021363692 51.1258406706463, 0.004202229067583 51.1260670895425, 0.004399588935504 51.12605147253781, 0.004539456625240999 51.12599148514911, 0.004647074796279 51.1259211802814, 0.004692080392013 51.1258200921806, 0.004744272510020001 51.12569927103149, 0.004756309934828 51.12557816766799, 0.004735379188708 51.12545249722189, 0.004616082918977 51.1253554674511, 0.004452679368795 51.12527506958999, 0.002973423590436 51.1250640950142, 0.002703120521444 51.1250753710715, 0.002535225394842 51.12518638370859, 0.002407125635327 51.1253554674511, 0.002371732013132 51.1255746157489))'), {u'name': u'Red Gra / Running Track', u'way_area': u'35100.3', u'leisure': u'track', u'lit': u'no', u'source': u'openstreetmap.org', u'surface': u'gravel', u'sport': u'running'}))  # noqa

        self.assert_has_feature(
            15, 16384, 10951, 'landuse',
            {'id': 95922608, 'kind': 'recreation_track', 'sort_rank': 72})

        # Cox Stadium recreation track
        self.assert_has_feature(
            16, 32768, 21903, 'pois',
            {'id': 95922608, 'kind': 'recreation_track', 'min_zoom': 16})

    def test_recreation_track_nodes(self):
        # Pista de Atletismo
        self.generate_fixtures(dsl.way(4218421638, wkt_loads('POINT (-64.30885444216 -36.6260189229092)'), {u'source': u'openstreetmap.org', u'sport': u'running', u'name': u'Pista de Atletismo', u'leisure': u'track'}))  # noqa

        self.assert_has_feature(
            16, 21060, 39942, 'pois',
            {'kind': 'recreation_track', 'min_zoom': 17})

        # cycle, Sand Pit
        self.generate_fixtures(dsl.way(418185265, wkt_loads('POINT (-122.01112772985 36.99488990613708)'), {u'source': u'openstreetmap.org', u'sport': u'cycling', u'name': u'Sand Pit', u'leisure': u'track'}))  # noqa

        self.assert_has_feature(
            16, 10556, 25509, 'pois',
            {'kind': 'recreation_track', 'min_zoom': 17})

        # motor, Mazda Raceway Laguna Seca
        self.generate_fixtures(dsl.way(444949878, wkt_loads('POINT (-121.752977609012 36.58526005267629)'), {u'source': u'openstreetmap.org', u'sport': u'motor', u'name': u'Mazda Raceway Laguna Seca', u'leisure': u'track'}))  # noqa

        self.assert_has_feature(
            16, 10603, 25602, 'pois',
            {'kind': 'recreation_track', 'min_zoom': 17})

    def test_fishing_area_node(self):
        # Unnamed fishing spot near Davis, CA
        self.generate_fixtures(dsl.way(2613055910, wkt_loads('POINT (-121.756509335551 38.51715097092738)'), {u'source': u'openstreetmap.org', u'leisure': u'fishing'}))  # noqa

        self.assert_has_feature(
            16, 10602, 25159, 'pois',
            {'kind': 'fishing_area', 'min_zoom': 17})

    def test_fishing_area_ways(self):
        #    16, 10471, 22459, 'pois',
        self.generate_fixtures(dsl.way(62099107, wkt_loads('POLYGON ((-122.481363711231 49.1669114107027, -122.479427212973 49.1672838608298, -122.477683672838 49.16750629580189, -122.476121502559 49.16769037511028, -122.474800440102 49.1677848814198, -122.474607212485 49.16779868437708, -122.474634431438 49.16745631116189, -122.474692462605 49.1674556650616, -122.474733695277 49.1674553713797, -122.4748520034 49.1674543141247, -122.474858830596 49.1675454141806, -122.474887037696 49.16756479714959, -122.475013969645 49.16754159632221, -122.475531309418 49.16745836693539, -122.477210260684 49.16720650467838, -122.47986666881 49.16680298202059, -122.481193570316 49.16667000090749, -122.481363711231 49.1669114107027))'), {u'source': u'openstreetmap.org', u'way_area': u'43410', u'name': u'Two Bit Bar', u'leisure': u'fishing'}))  # noqa

        self.assert_has_feature(
            16, 10471, 22460, 'pois',
            {'kind': 'fishing_area', 'min_zoom': 16})

        # Alpine Lake
        self.generate_fixtures(dsl.way(234164554, wkt_loads('POLYGON ((-111.585414840494 40.68151227447739, -111.58533758538 40.68175070547638, -111.585111479423 40.6819011890593, -111.584510326835 40.68206849861048, -111.584179387484 40.68208110130799, -111.583892645245 40.6820644112486, -111.583556226171 40.682009981189, -111.583374227495 40.68190956817138, -111.583318981105 40.68179668849949, -111.583346559384 40.68163768928918, -111.583434773945 40.6815707923359, -111.583649920455 40.68154156747469, -111.583964330805 40.68149136063199, -111.584234544042 40.6813951704831, -111.58454886456 40.6812487731699, -111.584802638628 40.68116089375347, -111.585056322864 40.68116089375347, -111.585282428821 40.68127391074909, -111.585414840494 40.68151227447739))'), {u'natural': u'water', u'name': u'Alpine Lake', u'way_area': u'21104.5', u'leisure': u'fishing', u'water': u'lake', u'source': u'openstreetmap.org', u'boat': u'private'}))  # noqa

        self.assert_has_feature(
            16, 12454, 24647, 'pois',
            {'kind': 'fishing_area', 'min_zoom': 16})

    def test_swimming_area_node(self):
        # Swimming hole at Seneca Rocks
        self.generate_fixtures(dsl.way(3733554139, wkt_loads('POINT (-79.36861763415348 38.8404317111475)'), {u'source': u'openstreetmap.org', u'leisure': u'swimming_area'}))  # noqa

        self.assert_has_feature(
            16, 18319, 25083, 'pois',
            {'kind': 'swimming_area', 'min_zoom': 16})

    def test_swimming_area_way(self):
        # Pine Lake Swimming Beach
        self.generate_fixtures(dsl.way(368533731, wkt_loads('POLYGON ((-122.041398798968 47.58771120686248, -122.041206200172 47.58791211575618, -122.040999138499 47.58781408491459, -122.040715720026 47.58783129182468, -122.040850107993 47.5875739146357, -122.041078998727 47.5873900903225, -122.04131893874 47.5875248989212, -122.041286240063 47.58755919174979, -122.041355230677 47.58759348455588, -122.041329808355 47.58761069153849, -122.041398798968 47.58771120686248))'), {u'source': u'openstreetmap.org', u'way_area': u'3699.56', u'name': u'Pine Lake Swimming Beach', u'leisure': u'swimming_area'}))  # noqa

        self.assert_has_feature(
            #    16, 10551, 22893, 'pois',
            16, 10551, 22892, 'pois',
            {'kind': 'swimming_area', 'min_zoom': 16})

    def test_firepit_node(self):
        # UC Berkeley area
        self.generate_fixtures(dsl.way(3795571179, wkt_loads('POINT (-122.267422829627 37.86982551522379)'), {u'source': u'openstreetmap.org', u'leisure': u'firepit'}))  # noqa

        self.assert_has_feature(
            16, 10509, 25309, 'pois',
            {'kind': 'firepit', 'min_zoom': 18})

    def test_firepit_way(self):
        # Bloomfield area
        self.generate_fixtures(dsl.way(349337076, wkt_loads('POLYGON ((-120.989937198076 39.3205694852611, -120.9899327065 39.32059165410438, -120.989919231771 39.3206116686028, -120.989898121361 39.32062709644129, -120.989871531229 39.3206364782333, -120.989842425814 39.3206387020653, -120.989813859388 39.32063342046418, -120.989789245549 39.3206212588812, -120.989770919917 39.3206036072083, -120.989761218112 39.32058220281161, -120.989760858786 39.3205596169963, -120.989770201265 39.32053807359638, -120.989787987908 39.3205200744282, -120.989812422083 39.32050756535101, -120.989840808846 39.32050186677066, -120.98986982443 39.32050367363768, -120.989896504394 39.3205125689822, -120.989917974129 39.32052771886307, -120.989932077679 39.32054731641071, -120.989937198076 39.3205694852611))'), {u'source': u'openstreetmap.org', u'way_area': u'300.608', u'name': u'Fire pit', u'leisure': u'firepit'}))  # noqa

        self.assert_has_feature(
            16, 10742, 24971, 'pois',
            {'kind': 'firepit', 'min_zoom': 18})

    def test_stone(self):
        # Old Man Boulder
        self.generate_fixtures(dsl.way(329837642, wkt_loads('POLYGON ((-122.635268924756 37.89168410851629, -122.635158342144 37.89176372090539, -122.635100760135 37.8917364981569, -122.635074170002 37.89167496336538, -122.63516984058 37.89163235687251, -122.635253024575 37.89163171883829, -122.635268924756 37.89168410851629))'), {u'sport': u'climbing', u'source': u'openstreetmap.org', u'way_area': u'258.122', u'natural': u'stone', u'name': u'Old Man Boulder'}))  # noqa

        self.assert_has_feature(
            16, 10442, 25304, 'landuse',
            {'kind': 'stone', 'sort_rank': 28})

        self.assert_has_feature(
            16, 10442, 25304, 'pois',
            {'kind': 'stone', 'min_zoom': 17, 'name': 'Old Man Boulder'})

    def test_rock(self):
        # Goodrich Pinnacle
        self.generate_fixtures(dsl.way(377706598, wkt_loads('POLYGON ((-119.566239075936 37.73144219101408, -119.565670532193 37.73176460006549, -119.565531023829 37.7320785532334, -119.565005329725 37.73238397957958, -119.564586894465 37.73190456124839, -119.564887291096 37.73169667972098, -119.565144838088 37.73171792259689, -119.565927989353 37.73129370334119, -119.566222996092 37.7313234008996, -119.566239075936 37.73144219101408))'), {u'sport': u'climbing', u'source': u'openstreetmap.org', u'way_area': u'10681.6', u'natural': u'rock', u'name': u'Goodrich Pinnacle'}))  # noqa

        self.assert_has_feature(
            16, 11001, 25340, 'landuse',
            {'kind': 'rock', 'sort_rank': 27})

        self.assert_has_feature(
            16, 11001, 25340, 'pois',
            {'kind': 'rock', 'min_zoom': 17, 'name': 'Goodrich Pinnacle'})

    def test_caravan_site_node(self):
        # Redwood Acres RV Park, Eureka CA
        self.generate_fixtures(dsl.way(2246385222, wkt_loads('POINT (-124.129336574678 40.7797228041273)'), {u'source': u'openstreetmap.org', u'tourism': u'caravan_site', u'name': u'Redwood Acres RV Park'}))  # noqa

        self.assert_has_feature(
            15, 5085, 12312, 'pois',
            {'kind': 'caravan_site', 'min_zoom': 15})

    def test_caravan_site_way(self):
        # Pillar Point RV Park
        self.generate_fixtures(dsl.way(291546386, wkt_loads('POLYGON ((-122.47365535761 37.5015223926268, -122.473432934745 37.50193231750269, -122.471975328365 37.50136938288639, -122.471683914887 37.50125678120049, -122.471698557426 37.50122620767539, -122.47177401591 37.50113569856521, -122.471851271025 37.50107148691729, -122.47193032277 37.50102045964159, -122.472031473071 37.50099565866259, -122.472215358209 37.501077402088, -122.47219891904 37.50112408203359, -122.47268796188 37.5012582778063, -122.473046659173 37.50137209102618, -122.473052228728 37.50130638297679, -122.47365535761 37.5015223926268))'), {u'website': u'http://pillarpointrvparklive.com/', u'addr:housenumber': u'4000', u'name': u'Pillar Point RV Park', u'source': u'openstreetmap.org', u'addr:postcode': u'94019', u'way_area': u'11068.8', u'phone': u'(650) 712-9277', u'addr:street': u'Cabrillo Highway North', u'tourism': u'caravan_site', u'addr:country': u'US', u'addr:city': u'Half Moon Bay'}))  # noqa

        self.assert_has_feature(
            14, 2618, 6348, 'landuse',
            {'kind': 'caravan_site', 'sort_rank': 71})

        self.assert_has_feature(
            14, 2618, 6348, 'pois',
            {'kind': 'caravan_site', 'min_zoom': 14})

    def test_picnic_site_node(self):
        # South Park, SF
        self.generate_fixtures(dsl.way(2401887217, wkt_loads('POINT (-122.394469044978 37.7811384844766)'), {u'source': u'openstreetmap.org', u'tourism': u'picnic_site'}))  # noqa

        self.assert_has_feature(
            16, 10486, 25329, 'pois',
            {'kind': 'picnic_site', 'min_zoom': 16})

        # Why is this missing?
        # Golden Gate Park, SF
        self.generate_fixtures(dsl.way(3297410094, wkt_loads('POINT (-122.474581879994 37.77030601950328)'), {u'source': u'openstreetmap.org', u'tourism': u'picnic_site'}))  # noqa

        self.assert_has_feature(
            16, 10472, 25332, 'pois',
            {'kind': 'picnic_site', 'min_zoom': 16})

    def test_picnic_site_way(self):
        # Golden Gate Park, SF
        self.generate_fixtures(dsl.way(400701941, wkt_loads('POLYGON ((-122.459222036108 37.76803425324729, -122.459040127263 37.76805037286478, -122.459021801631 37.7678423088086, -122.459187181475 37.76781411714908, -122.459222036108 37.76803425324729))'), {u'source': u'openstreetmap.org', u'way_area': u'592.035', u'tourism': u'picnic_site'}))  # noqa

        self.assert_has_feature(
            16, 10474, 25332, 'landuse',
            {'kind': 'picnic_site', 'sort_rank': 122})

        self.assert_has_feature(
            16, 10474, 25332, 'pois',
            {'kind': 'picnic_site', 'min_zoom': 16})

    def test_picnic_site_building(self):
        # building, South Park, SF
        self.generate_fixtures(dsl.way(231863022, wkt_loads('POLYGON ((-122.394083398226 37.78154005346708, -122.393937062666 37.7816447762805, -122.393858010921 37.78158691250707, -122.394002280356 37.78146039303109, -122.394083398226 37.78154005346708))'), {u'building': u'no', u'name': u'Picnic Area', u'way_area': u'301.836', u'note': u'Five tables.', u'source': u'openstreetmap.org', u'tourism': u'picnic_site'}))  # noqa

        self.assert_has_feature(
            16, 10486, 25329, 'pois',
            {'kind': 'picnic_site', 'min_zoom': 16, 'id': 231863022})

    def test_fort_node(self):
        # Fort Strong
        self.generate_fixtures(dsl.way(1148222790, wkt_loads('POINT (-70.95587891853059 42.32996679009089)'), {u'source': u'openstreetmap.org', u'historic': u'fort', u'wikidata': u'Q5472138', u'name': u'Fort Strong'}))  # noqa

        self.assert_has_feature(
            16, 19850, 24247, 'pois',
            {'kind': 'fort', 'min_zoom': 16})

    def test_fort_way(self):
        # Battery 2
        self.generate_fixtures(dsl.way(265893625, wkt_loads('POLYGON ((-73.9637687104612 40.84842168440429, -73.96362614782558 40.8484769976283, -73.9636460904249 40.84850642098299, -73.96361078663419 40.84852238977281, -73.96359192201329 40.84849391775769, -73.963534070509 40.84851620611419, -73.9634516051659 40.8487882185932, -73.96357422520219 40.84897189263839, -73.9635187991491 40.8489932974607, -73.96339501130299 40.84879440222639, -73.9634823275486 40.8484804631974, -73.9637440067909 40.8483779910018, -73.9637687104612 40.84842168440429))'), {u'way_area': u'726.454', u'source': u'openstreetmap.org', u'historic': u'fort', u'name': u'Battery 2'}))  # noqa

        self.assert_has_feature(
            16, 19303, 24607, 'landuse',
            {'kind': 'fort', 'sort_rank': 53})

        self.assert_has_feature(
            16, 19303, 24607, 'pois',
            {'kind': 'fort', 'min_zoom': (lambda z: z >= 15 and z < 16)})

        # Fort Monroe
        self.generate_fixtures(dsl.way(51064272, wkt_loads('POLYGON ((-76.31040871158289 37.0023446768107, -76.3100868452166 37.0031222674211, -76.30959600574539 37.00316940039099, -76.3094458074299 37.00475662375248, -76.309920477226 37.0048508876365, -76.3101002301144 37.00566051919608, -76.30907561170129 37.00578261599479, -76.30871619575611 37.00551266846238, -76.3071026418428 37.00604459976819, -76.30708539418931 37.00643592379419, -76.30622983871268 37.00692430483049, -76.30590797234639 37.00597106936429, -76.3062325336586 37.0057204915612, -76.305553946293 37.00491078890229, -76.3051382059795 37.00504579972589, -76.30416452204301 37.00443530785439, -76.30445422872218 37.0040904602791, -76.3046232018271 37.00411399059809, -76.30499330772409 37.00337715815628, -76.3048618841981 37.00331926438859, -76.30495315303089 37.0029038197136, -76.30545998251419 37.00280101635519, -76.305588800926 37.0029381113821, -76.306455136186 37.00258888086299, -76.30640150676349 37.00242825437279, -76.30683009298561 37.00217077779468, -76.30729470165049 37.00207048436938, -76.3074368151285 37.00221827005718, -76.30830584533429 37.0018541858668, -76.30824422090579 37.00169140559281, -76.3086491814359 37.00144719865776, -76.3090326722307 37.00173846770868, -76.3089548781271 37.00189271071981, -76.3097945334232 37.00231691325678, -76.30991248222 37.00218828249908, -76.31040871158289 37.0023446768107))'), {u'name': u'Fort Monroe', u'barrier': u'wall', u'way_area': u'277328', u'source': u'openstreetmap.org', u'historic': u'fort', u'wikidata': u'Q1438639', u'tourism': u'attraction'}))  # noqa

        self.assert_has_feature(
            13, 2359, 3188, 'landuse',
            {'kind': 'fort'})

        self.assert_has_feature(
            13, 2359, 3188, 'pois',
            {'kind': 'fort', 'min_zoom': 13, 'name': 'Fort Monroe'})
